/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author XPF
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadFileParams } from '/#/axios';
import { UploadApiResult } from '../sys/upload';

const { apiUrl, adminPath } = useGlobSetting();

export interface PhysicalSkillsScore extends BasicModel<PhysicalSkillsScore> {
  scoreId?: string; // 评分主键
  scoreAdaptSex?: string; // 评分适配性别
  scoreAdaptGrade?: string; // 评分适配年级（单选）
  termId?: string; // 关联单项指标
  score1?: string; // 分值1
  score2?: string; // 分值2“区间值不为空”
  scoreGradeId?: string; // 关联单项指标得分及对应等级
}

export const physicalSkillsScoreList = (params?: PhysicalSkillsScore | any) =>
  defHttp.get<PhysicalSkillsScore>({ url: adminPath + '/physical/physicalSkillsScore/list', params });

export const physicalSkillsScoreListData = (params?: PhysicalSkillsScore | any) =>
  defHttp.post<Page<PhysicalSkillsScore>>({ url: adminPath + '/physical/physicalSkillsScore/listData', params });

export const physicalSkillsScoreForm = (params?: PhysicalSkillsScore | any) =>
  defHttp.get<PhysicalSkillsScore>({ url: adminPath + '/physical/physicalSkillsScore/form', params });

export const physicalSkillsScoreSave = (params?: any, data?: PhysicalSkillsScore | any) =>
  defHttp.postJson<PhysicalSkillsScore>({ url: adminPath + '/physical/physicalSkillsScore/save', params, data });

export const physicalSkillsScoreDelete = (params?: PhysicalSkillsScore | any) =>
  defHttp.get<PhysicalSkillsScore>({ url: adminPath + '/physical/physicalSkillsScore/delete', params });

export const physicalSkillsScoreSelectData = (params?: any, data?: PhysicalSkillsScore | any) =>
  defHttp.post<PhysicalSkillsScore>({ url: adminPath + '/physical/physicalSkillsScoreGrade/selectData', params, data });

export const physicalSkillsScoreSaveGradeLevel = (params?: any, data?: PhysicalSkillsScore | any) =>
  defHttp.post<PhysicalSkillsScore>({ url: adminPath + '/physical/physicalSkillsScore/saveGradeLevel', params, data });

export const physicalSkillsScoreSelectGradeLevel = (params?: any, data?: PhysicalSkillsScore | any) =>
  defHttp.post<PhysicalSkillsScore>({ url: adminPath + '/physical/physicalSkillsScore/selectGradeLevel', params, data });

// export const physicalSkillsScoreImportData = (params?: any, data?: PhysicalSkillsScore | any) =>
//   defHttp.post<PhysicalSkillsScore>({ url: adminPath + '/physical/physicalSkillsScore/importData', params, data });

export const physicalSkillsScoreImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: apiUrl + adminPath + '/physical/physicalSkillsScore/importData',
      onUploadProgress,
    },
    params,
  );
